//
//  GCMCloseTaskViewController.m
//  GeeCityManager
//
//  Created by 聚城科技 on 16/4/5.
//  Copyright © 2016年 聚城科技. All rights reserved.
//

#import "GCMCloseTaskViewController.h"
#import "HJDatePickerView.h"

@interface GCMCloseTaskViewController ()

@end

@implementation GCMCloseTaskViewController{

    UIScrollView *_scrollV;
    UIView *_view1;
    UIView *_view2;
    UIView *_view3;
    UIButton *_overTimeBtn1;
    UIButton *_overTimeBtn2;
    UIButton *_closeTimeBtn1;
    UIButton *_closeTimeBtn2;
    UIButton *_Submit;
    NSString *_timestr;
    UIButton * _jbButton;
    UIButton * _fsButton;
    NSArray *_levelArray;
    NSArray *_typeArray;
    NSMutableArray *_muenArr;
    NSMutableArray *_muenArr1;
    UIButton * _fxButton;
    UIButton * _selectBtn;
    UITextField *_fxcsTF;
    UITextField *_gbsmTF;
    UITextField *_jjfaTF;
    
    QRadioButton *_zl1;
    QRadioButton *_zl2;
    QRadioButton *_td1;
    QRadioButton *_td2;
    QRadioButton *_jsx1;
    QRadioButton *_jsx2;
    QRadioButton *_gblx1;
    QRadioButton *_gblx2;
    
    
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self createScrollView];
    [self downLoadData];
    [self createUI];
}

-(void)downLoadData{

    
    [GCMReviceHttpRequst postFenLeiDataWithURL:TASKLEVEL_URL Success:^(id obj, NSError *err) {
         _levelArray  = obj;
        //NSLog(@"task1%@",_clfsArray);
        [GCMReviceHttpRequst postFenLeiDataWithURL:TASKTYPE_URL Success:^(id obj, NSError *err) {
            _typeArray   = obj;
            //NSLog(@"tasktype%@",_jbArray);
            [self createUI];
        }];
    }];
    
}

-(void)createUI{

    //    View1
    _view1 = [[UIView alloc]initWithFrame:CGRectMake(10, 10, SCREEN_WIDTH  - 20, 250)];
    _view1.backgroundColor = [UIColor whiteColor];
    _view1.layer.borderColor = [[UIColor redColor] CGColor];
    _view1.layer.borderWidth  = 0.5;
    _view1.layer.cornerRadius = 10;
    _view1.userInteractionEnabled = YES;
    [_scrollV addSubview:_view1];
// 添加view1；
    UILabel *labelYJSJ  = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, (SCREEN_WIDTH - 40)/3 + 20 , 50)];
    labelYJSJ.text = @"任务完成时间:";
    labelYJSJ.font = [UIFont systemFontOfSize:15];
    labelYJSJ.textColor  = [UIColor lightGrayColor];
    [_view1 addSubview:labelYJSJ];
    
    _overTimeBtn1 = [[UIButton alloc]initWithFrame:CGRectMake((SCREEN_WIDTH - 40) / 3 + 10 , 0, (SCREEN_WIDTH - 40) / 9*4 , 50)];
    //_overTimeBtn1.backgroundColor = [UIColor redColor];
    _overTimeBtn1.titleLabel.font = [UIFont systemFontOfSize:14];
    NSString *str  = [NSString stringWithFormat:@"%@",[NSDate date]];
    NSArray *arrayCurrentTime = [str componentsSeparatedByString:@" "];
    _timestr = [NSString stringWithFormat:@"%@ %@",arrayCurrentTime[0],arrayCurrentTime[1]];
    //NSLog(@"时间%@",timestr);
    [_overTimeBtn1 setTitle:_timestr forState:UIControlStateNormal];
    NSArray *arrayt1 = [_timestr componentsSeparatedByString:@" "];
    [_overTimeBtn1 setTitle:arrayt1[0] forState:UIControlStateNormal];
    [_overTimeBtn1 setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    [_overTimeBtn1 addTarget: self action:@selector(onyjshBtn1Click) forControlEvents:UIControlEventTouchUpInside];
    [_view1 addSubview:_overTimeBtn1];
    
    _overTimeBtn2 = [[UIButton alloc]initWithFrame:CGRectMake((SCREEN_WIDTH - 40) / 3 + 10 + (SCREEN_WIDTH - 40) / 9*4 , 0, (SCREEN_WIDTH - 40) / 9*2 , 50)];
    _overTimeBtn2.titleLabel.font = [UIFont systemFontOfSize:15];
    //_overTimeBtn2.backgroundColor = [UIColor blueColor];
    [_overTimeBtn2 setTitle:arrayt1[1] forState:UIControlStateNormal];
    [_overTimeBtn2 setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    [_overTimeBtn2 addTarget: self action:@selector(onyjshBtn2Click) forControlEvents:UIControlEventTouchUpInside];
    [_view1 addSubview:_overTimeBtn2];
    
    UILabel *labelPGSJ  = [[UILabel alloc]initWithFrame:CGRectMake(10, 50, (SCREEN_WIDTH - 20)/3 +20 , 50)];
    labelPGSJ.text = @"任务关闭时间:";
    labelPGSJ.textColor  = [UIColor lightGrayColor];
    labelPGSJ.font = [UIFont systemFontOfSize:14];
    [_view1 addSubview:labelPGSJ];
    
    _closeTimeBtn1 = [[UIButton alloc]initWithFrame:CGRectMake((SCREEN_WIDTH - 40) / 3 + 10 , 50, (SCREEN_WIDTH - 40) / 9*4 , 50)];
    //_closeTimeBtn1.backgroundColor = [UIColor redColor];
    _closeTimeBtn1.titleLabel.font = [UIFont systemFontOfSize:15];
    NSString *timestr1 = [NSString stringWithFormat:@"%@",[NSDate date]];
    //NSLog(@"%@",timestr);
    [_closeTimeBtn1 setTitle:timestr1 forState:UIControlStateNormal];
    NSArray *arrayt2 = [timestr1 componentsSeparatedByString:@" "];
    [_closeTimeBtn1 setTitle:arrayt2[0] forState:UIControlStateNormal];
    [_closeTimeBtn1 setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    [_closeTimeBtn1 addTarget: self action:@selector(onpgshBtn1Click) forControlEvents:UIControlEventTouchUpInside];
    [_view1 addSubview:_closeTimeBtn1];
    
    _closeTimeBtn2 = [[UIButton alloc]initWithFrame:CGRectMake((SCREEN_WIDTH - 40) / 3 + 10 + (SCREEN_WIDTH - 40) / 9*4 , 50, (SCREEN_WIDTH - 40) / 9*2 , 50)];
     _closeTimeBtn2.titleLabel.font = [UIFont systemFontOfSize:15];
    //_pgTimeBtn2.backgroundColor = [UIColor blueColor];
    [_closeTimeBtn2 setTitle:arrayt1[1] forState:UIControlStateNormal];
    [_closeTimeBtn2 setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    [_closeTimeBtn2 addTarget: self action:@selector(onpgshBtn2Click) forControlEvents:UIControlEventTouchUpInside];
    [_view1 addSubview:_closeTimeBtn2];
    
    _jbButton  = [[UIButton alloc]initWithFrame:CGRectMake(_view1.bounds.size.width/3, 100, _view1.bounds.size.width/3 *2, 50)];
    [_jbButton addTarget:self action:@selector(onLeftbutton) forControlEvents:UIControlEventTouchUpInside];
    NSMutableArray *fenleiA1 = [[NSMutableArray alloc]init];
//    NSLog(@"asdfasdf%@",_levelArray);
    for (NSDictionary *dic in _levelArray) {
        NSString *str =[ NSString stringWithFormat:@"%@", [dic valueForKey:@"name"] ];
        [fenleiA1 addObject:str];
        _muenArr = [NSMutableArray arrayWithArray:fenleiA1];
    }
    //NSLog(@"asdfasdf%@",_muenArr);
    [_jbButton setTitle:_muenArr[0] forState:UIControlStateNormal];
    [_jbButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    
    [_view1 addSubview:_jbButton];
    
    UILabel * labJD =[[UILabel alloc]initWithFrame:CGRectMake(10, 100, _view1.bounds.size.width / 3, 50)];
    labJD.font = [UIFont systemFontOfSize:15];
    labJD.text = @"任务最重级别:";
    labJD.textColor = [UIColor lightGrayColor];
    [_view1 addSubview:labJD];
    
    
    _fsButton  = [[UIButton alloc]initWithFrame:CGRectMake(_view1.bounds.size.width/3, 150, _view1.bounds.size.width/3 *2, 50)];
    [_fsButton addTarget:self action:@selector(onRightbutton) forControlEvents:UIControlEventTouchUpInside];
    //NSLog(@"asdfasdf%@",_typeArray);
    NSMutableArray *fenleiA2 = [[NSMutableArray alloc]init];
    for (NSDictionary *dic in _typeArray) {
        NSString *str =[ NSString stringWithFormat:@"%@", [dic valueForKey:@"name"] ];
        [fenleiA2 addObject:str];
        _muenArr1 = [NSMutableArray arrayWithArray:fenleiA2];
    }
    [_fsButton setTitle:_muenArr1[0] forState:UIControlStateNormal];
    [_fsButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    [_view1 addSubview:_fsButton];
    
    UILabel * labJD1 =[[UILabel alloc]initWithFrame:CGRectMake(10, 150, _view1.bounds.size.width / 3, 50)];
    labJD1.text = @"任务处理方式:";
    labJD1.font = [UIFont systemFontOfSize:15];
    labJD1.textColor = [UIColor lightGrayColor];
    [_view1 addSubview:labJD1];
    
    
    _fxButton  = [[UIButton alloc]initWithFrame:CGRectMake(10, 200, _view1.bounds.size.width / 2  - 20, 50)];
    [_view1 addSubview:_fxButton];
    UILabel *labelkhfy2  = [[UILabel alloc]initWithFrame:CGRectMake(30, 10, _fxButton.bounds.size.width - 20  , 20)];
    labelkhfy2.text = @"是否返修";
    labelkhfy2.textColor = [UIColor redColor];
    [_fxButton addSubview:labelkhfy2];
    UILabel *klabel = [[UILabel alloc]initWithFrame:CGRectMake( 0 , 10, 20 , 20)];
    klabel.layer.borderColor = [[UIColor lightGrayColor]CGColor];
    klabel.layer.borderWidth = 1;
    [_fxButton addSubview:klabel];
    
    _selectBtn = [[UIButton alloc]initWithFrame:CGRectMake( 0 , 10, 20 , 20)];
    [_selectBtn setImage:[UIImage imageNamed:@"task_btn_submit"] forState:UIControlStateNormal];
    [_selectBtn setImage:[UIImage imageNamed:@"select"] forState:UIControlStateSelected];
    [_selectBtn addTarget:self action:@selector(seleButtonClick:) forControlEvents:UIControlEventTouchUpInside];
    [_fxButton addSubview:_selectBtn];
    
//    view2
    _view2 = [[UIView alloc]initWithFrame:CGRectMake(10, 270, SCREEN_WIDTH  - 20, 200)];
    _view2.backgroundColor = [UIColor whiteColor];
    _view2.layer.borderColor = [[UIColor redColor] CGColor];
    _view2.layer.borderWidth  = 0.5;
    _view2.layer.cornerRadius = 10;
    [_scrollV addSubview:_view2];

    NSArray *_array = @[@"任务评价：",@"质  量：",@"态  度：",@"及 时 性："];
    for (int  i = 0; i < 4; i ++) {
        UILabel *label  = [[UILabel alloc]initWithFrame:CGRectMake(10, 50*i, _view2.bounds.size.width/3, 50)];
        label.textColor = [UIColor lightGrayColor];
        label.text = _array[i];
        [_view2 addSubview:label];
        
    }
//质量
    _zl1 = [[QRadioButton alloc] initWithDelegate:self groupId:@"groupId1"];
    _zl1.frame = CGRectMake(_view2.bounds.size.width/3, 50, _view2.bounds.size.width/3, 50);
    [_zl1 setTitle:@"满意" forState:UIControlStateNormal];
    [_zl1 setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    [_zl1.titleLabel setFont:[UIFont boldSystemFontOfSize:15.0f]];
    [_view2 addSubview:_zl1];
    [_zl1 setChecked:YES];
    
    _zl2 = [[QRadioButton alloc] initWithDelegate:self groupId:@"groupId1"];
    _zl2.frame = CGRectMake(_view2.bounds.size.width/3*2, 50 , _view2.bounds.size.width/3, 50);
    [_zl2 setTitle:@"不满意" forState:UIControlStateNormal];
    [_zl2 setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    [_zl2.titleLabel setFont:[UIFont boldSystemFontOfSize:15.0f]];
    [_view2 addSubview:_zl2];
//    态度
    _td1 = [[QRadioButton alloc] initWithDelegate:self groupId:@"groupId2"];
    _td1.frame = CGRectMake(_view2.bounds.size.width/3, 100, _view2.bounds.size.width/3, 50);
    [_td1 setTitle:@"满意" forState:UIControlStateNormal];
    [_td1 setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    [_td1.titleLabel setFont:[UIFont boldSystemFontOfSize:15.0f]];
    [_view2 addSubview:_td1];
    [_td1 setChecked:YES];
    
    _td2 = [[QRadioButton alloc] initWithDelegate:self groupId:@"groupId2"];
    _td2.frame = CGRectMake(_view2.bounds.size.width/3*2, 100 , _view2.bounds.size.width/3, 50);
    [_td2 setTitle:@"不满意" forState:UIControlStateNormal];
    [_td2 setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    [_td2.titleLabel setFont:[UIFont boldSystemFontOfSize:15.0f]];
    [_view2 addSubview:_td2];
    //及时性
    _jsx1 = [[QRadioButton alloc] initWithDelegate:self groupId:@"groupId3"];
    _jsx1.frame = CGRectMake(_view2.bounds.size.width/3, 150, _view2.bounds.size.width/3, 50);
    [_jsx1 setTitle:@"满意" forState:UIControlStateNormal];
    [_jsx1 setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    [_jsx1.titleLabel setFont:[UIFont boldSystemFontOfSize:15.0f]];
    [_view2 addSubview:_jsx1];
    [_jsx1 setChecked:YES];
    
    _jsx2 = [[QRadioButton alloc] initWithDelegate:self groupId:@"groupId3"];
    _jsx2.frame = CGRectMake(_view2.bounds.size.width/3*2, 150 , _view2.bounds.size.width/3, 50);
    [_jsx2 setTitle:@"不满意" forState:UIControlStateNormal];
    [_jsx2 setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    [_jsx2.titleLabel setFont:[UIFont boldSystemFontOfSize:15.0f]];
    [_view2 addSubview:_jsx2];

//    view3
    _view3 = [[UIView alloc]initWithFrame:CGRectMake(10, 480, SCREEN_WIDTH  - 20, 200)];
    _view3.backgroundColor = [UIColor whiteColor];
    _view3.layer.borderColor = [[UIColor redColor] CGColor];
    _view3.layer.borderWidth  = 0.5;
    _view3.layer.cornerRadius = 10;
    [_scrollV addSubview:_view3];
    
    UILabel *labeljjfa  = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, _view3.bounds.size.width/3, 50)];
    labeljjfa.textColor = [UIColor lightGrayColor];
    labeljjfa.text = @"解决方案：";
    [_view3 addSubview:labeljjfa];
    
    UILabel *labelgblx  = [[UILabel alloc]initWithFrame:CGRectMake(10, 50, _view3.bounds.size.width/3, 50)];
    labelgblx.textColor = [UIColor lightGrayColor];
    labelgblx.text = @"关闭类型:";
    [_view3 addSubview:labelgblx];
//  关闭类型
    _gblx1 = [[QRadioButton alloc] initWithDelegate:self groupId:@"groupId4"];
    _gblx1.frame = CGRectMake(_view2.bounds.size.width/3, 50, _view2.bounds.size.width/3, 50);
    [_gblx1 setTitle:@"正常关闭" forState:UIControlStateNormal];
    [_gblx1 setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    [_gblx1.titleLabel setFont:[UIFont boldSystemFontOfSize:15.0f]];
    [_view3 addSubview:_gblx1];
    [_gblx1 setChecked:YES];
    
    _gblx2 = [[QRadioButton alloc] initWithDelegate:self groupId:@"groupId4"];
    _gblx2.frame = CGRectMake(_view2.bounds.size.width/3*2, 50 , _view2.bounds.size.width/3, 50);
    [_gblx2 setTitle:@"非正常关闭" forState:UIControlStateNormal];
    [_gblx2 setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    [_gblx2.titleLabel setFont:[UIFont boldSystemFontOfSize:15.0f]];
    [_view3 addSubview:_gblx2];
    
    _gbsmTF = [[UITextField alloc]initWithFrame:CGRectMake(10, 100, _view3.bounds.size.width - 20, 50)];
    _gbsmTF.placeholder = @"请填写关闭说明";
    _gbsmTF.tag = 4151;
    [_view3 addSubview:_gbsmTF];
    _jjfaTF = [[UITextField alloc]initWithFrame:CGRectMake(10, 150, _view3.bounds.size.width - 20, 50)];
    _jjfaTF.placeholder = @"请填写解决方案";
    _jjfaTF.tag = 4152;
    [_view3 addSubview:_jjfaTF];
    
    _Submit = [[UIButton alloc]initWithFrame:CGRectMake(20, _view3.frame.origin.y + 200 + 20, SCREEN_WIDTH - 40, 40)];
    [_Submit setTitle:@"关闭" forState:UIControlStateNormal];
    [_Submit setBackgroundColor:[UIColor colorWithRed:0 green:0.67 blue:0.65 alpha:1]];
    [_Submit addTarget:self action:@selector(onSubClick) forControlEvents:UIControlEventTouchUpInside];
    [_scrollV addSubview:_Submit];
    
}
-(void)onSubClick{

    [self Submit];
}

-(void)Submit{
    

    NSMutableDictionary *parameters = [[NSMutableDictionary alloc]init];
    parameters[@"taskId"] = self.idd;
    parameters[@"finalLevel"] = @"20";
    parameters[@"handleType"] = @"15";
    if (_selectBtn.selected) {
        parameters[@"repair"] = @"1";
        parameters[@"repairCount"] = _fxcsTF.text;
    }else{
        parameters[@"repair"] = @"0";
        parameters[@"repairCount"] = @"";
    }
    if ([_zl1.groupId isEqualToString:@"groupId1"]&& _zl1.checked == YES) {
        parameters[@"quality"] = @"1";
    }else{
        parameters[@"quality"] = @"0";
    }
    if ([_td1.groupId isEqualToString:@"groupId2"]&& _td1.checked == YES) {
        parameters[@"attitude"] = @"1";
    }else{
        parameters[@"attitude"] = @"0";
    }
    if ([_jsx1.groupId isEqualToString:@"groupId3"]&& _jsx1.checked == YES) {
        parameters[@"timeliness"] = @"1";
    }else{
        parameters[@"timeliness"] = @"0";
    }
    if ([_gblx1.groupId isEqualToString:@"groupId4"]&& _gblx1.checked == YES) {
        parameters[@"closeType"] = @"1";
    }else{
        parameters[@"closeType"] = @"0";
    }
    parameters[@"closeContent"] = _gbsmTF.text;
    parameters[@"solution"] = _jjfaTF.text;
    parameters[@"promiseTime"] = [NSString stringWithFormat:@"%@ %@",_overTimeBtn1.titleLabel.text,_overTimeBtn2.titleLabel.text];
    parameters[@"closeTime"] = [NSString stringWithFormat:@"%@ %@",_closeTimeBtn1.titleLabel.text,_closeTimeBtn2.titleLabel.text];
    NSLog(@"测试%@",parameters);
    [GCMTaskHttpRequst postDataWithParmerts:parameters WithUrl:TASKCLOSE_URL Success:^(id obj, NSError *err) {
        NSLog(@"测试成功了%@",obj);
        NSLog(@"测试成功了");
    }];
    [self.navigationController popViewControllerAnimated:YES];
    
}

#pragma mark--展示下拉菜单
-(void)onLeftbutton{
    
    __weak typeof(self)weakSelf=self;
    if (!_leftmuen) {
        
        _leftmuen=[[SCXCreateAlertView alloc]initWithNameArray:_muenArr andMenuOrigin:CGPointMake((SCREEN_WIDTH - 20)/2, _jbButton.frame.origin.y + 64 +50  ) andMenuWidth:SCREEN_WIDTH/2 andHeight:40 andLayer:0 andTableViewBackGroundColor:[UIColor clearColor] andIsSharp:YES andType:kNavigationPop];
        _leftmuen.delegate = weakSelf;
        _leftmuen.tableViewDelegate=self;
        _leftmuen.dismiss=^(){
            [weakSelf.leftmuen removeFromSuperview];
            _leftmuen=nil;
        };
        [self.view addSubview:_leftmuen];
    }
    else{
        [_leftmuen dismissWithCompletion:^(SCXCreateAlertView *create){
            [_leftmuen removeFromSuperview];
            _leftmuen = nil;
        }];
    }
}

#pragma mark--自定义下拉菜单代理方法,点击下拉菜单某一行时候对应的响应时间，点击完成后试图要消失，用一个block通知；
-(void)tableViewDidSelectRowAtIndexPath:(NSIndexPath *)indexPath andPopType:(popType)popViewType{
    
    //改变导航栏文字
    if (popViewType == kNavigationPop) {
        [_jbButton setTitle:_muenArr[indexPath.row] forState:UIControlStateNormal];
    }
    [_leftmuen dismissWithCompletion:nil];//点击完成后视图消失;
    
}
#pragma mark---同上
-(void)onRightbutton{
    __weak typeof(self)weakSelf=self;
    if (!_rightmuen) {
        
        _rightmuen=[[SCXCreateAlertView2 alloc]initWithNameArray:_muenArr1 andMenuOrigin:CGPointMake((SCREEN_WIDTH - 20)/2, _fsButton.frame.origin.y + 64 +50 ) andMenuWidth:SCREEN_WIDTH/2 andHeight:40 andLayer:0 andTableViewBackGroundColor:[UIColor clearColor] andIsSharp:YES andType:kNavigationPop2];
        _rightmuen.delegate = weakSelf;
        _rightmuen.tableViewDelegate=self;
        _rightmuen.dismiss=^(){
            [weakSelf.rightmuen removeFromSuperview];
            _rightmuen=nil;
        };
        [self.view addSubview:_rightmuen];
    }
    else{
        [_rightmuen dismissWithCompletion:^(SCXCreateAlertView2 *create) {
            [_rightmuen removeFromSuperview];
            _rightmuen = nil;
        }];
    }
}

-(void)secondtableViewDidSelectRowAtIndexPath:(NSIndexPath *)indexPath andPopType:(popType2)popViewType{
    //改变导航栏文字
    if (popViewType==kNavigationPop2) {
        [_fsButton setTitle:_muenArr1[indexPath.row] forState:UIControlStateNormal];
    }
    [_rightmuen dismissWithCompletion:nil];//点击完成后视图消失;
    
}

#pragma mark - QRadioButtonDelegate

- (void)didSelectedRadioButton:(QRadioButton *)radio groupId:(NSString *)groupId {
    //NSLog(@"did selected radio:%@ groupId:%@", radio.titleLabel.text, groupId);
}

-(void)createScrollView{

    //    创建可以滑动的视图
    _scrollV = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 64, SCREEN_WIDTH, SCREEN_HEIGHT - 64)];
    //_scrollV.backgroundColor = [UIColor blueColor];
    _scrollV.delegate = self;
    _scrollV.pagingEnabled = NO;
    _scrollV.alwaysBounceHorizontal = NO;
    _scrollV.alwaysBounceVertical = NO;
    _scrollV.showsHorizontalScrollIndicator = NO;
    _scrollV.showsVerticalScrollIndicator = NO;
    _scrollV.bounces = NO;
    _scrollV.contentOffset = CGPointMake(0, 0);
    _scrollV.contentSize = CGSizeMake(SCREEN_WIDTH, 800 );
    _scrollV.backgroundColor = [UIColor colorWithRed:.95 green:.95 blue:.95 alpha:1.0];
    self.automaticallyAdjustsScrollViewInsets = NO;
    [self.view addSubview:_scrollV];
    
}


//获取时间1
-(void)onyjshBtn1Click{
    
    HJDatePickerView * datePickerView = [[HJDatePickerView alloc]init];
    UIWindow * window = [UIApplication sharedApplication].keyWindow;
    [window addSubview:datePickerView];
    
    [datePickerView setGetTimeBlock:^(NSString *time){
        
        NSString *nstring = time;
        NSArray *array = [nstring componentsSeparatedByString:@" "];
        [_overTimeBtn1 setTitle:array[0] forState:UIControlStateNormal];
    }];
    
}
//获取时间2
-(void)onyjshBtn2Click{
    
    HJDatePickerView * datePickerView = [[HJDatePickerView alloc]init];
    UIWindow * window = [UIApplication sharedApplication].keyWindow;
    [window addSubview:datePickerView];
    
    [datePickerView setGetTimeBlock:^(NSString *time){
        
        NSString *nstring = time;
        NSArray *array = [nstring componentsSeparatedByString:@" "];
        [_overTimeBtn2 setTitle:array[1] forState:UIControlStateNormal];
    }];
    
}

//获取时间1
-(void)onpgshBtn1Click{
    
    HJDatePickerView * datePickerView = [[HJDatePickerView alloc]init];
    UIWindow * window = [UIApplication sharedApplication].keyWindow;
    [window addSubview:datePickerView];
    
    [datePickerView setGetTimeBlock:^(NSString *time){
        
        NSString *nstring = time;
        NSArray *array = [nstring componentsSeparatedByString:@" "];
        [_closeTimeBtn1 setTitle:array[0] forState:UIControlStateNormal];
    }];
    
}
//获取时间2
-(void)onpgshBtn2Click{
    
    HJDatePickerView * datePickerView = [[HJDatePickerView alloc]init];
    UIWindow * window = [UIApplication sharedApplication].keyWindow;
    [window addSubview:datePickerView];
    
    [datePickerView setGetTimeBlock:^(NSString *time){
        
        NSString *nstring = time;
        NSArray *array = [nstring componentsSeparatedByString:@" "];
        [_closeTimeBtn2 setTitle:array[1] forState:UIControlStateNormal];
    }];
    
}

- (void)seleButtonClick:(UIButton *)button {
    
    button.selected = !button.selected;
    if (_selectBtn.selected == YES) {
        _fxcsTF = [[UITextField alloc]initWithFrame:CGRectMake(150, 200, 150, 40)];
        _fxcsTF.placeholder = @"请输入返修次数";
        [_view1 addSubview:_fxcsTF];
    }else{
    
        [_fxcsTF removeFromSuperview];
    }
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
